﻿package net.wangit.dev.wizard.element;

import java.util.List;

import net.wangit.LabelUtil;
import net.wangit.context.ActionContext;
import net.wangit.dev.wizard.WizardUtil;
import net.wangit.jdbc.ColumnRow;
import net.wangit.jdbc.DB;
import net.wangit.jdbc.Table;


public class AQueryButton {

	public AQueryButton() {
	}

	public static final void create(DB db, ActionContext ac, String unitId,
			String forward, List<String> elements) throws Exception {
		String elementId = WizardUtil.getElementId("query", elements);
		Table table = new Table("dev", "ELEMENT");
		ColumnRow cRow = table.addInsertRow();
		cRow.set("eid", elementId);
		cRow.set("uid", unitId);
		cRow.set("c", 41);
		cRow.set("l", "/common/images/tool/query.png");
		cRow.set("n", LabelUtil.get(ac, "dev", "toolbar.query"));
		cRow.set("b", 0);
		cRow.set("o", 2);
		cRow.set("a", "1");
		cRow.set("aa", "net.wangit.support.action.QueryAction");
		cRow.set("asf", forward);
		cRow.set("aff", forward);
		cRow.set("au", 0);
		cRow.set("s", 1);
		db.save(table);
	}
}
